package com.gopay.common.cps.dao.solution.impl;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;

import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.constants.cps.CpsConstants;
import com.gopay.common.cps.dao.solution.CpsAcctProdMastQueryDAO;
import com.gopay.common.domain.cps.CpsAcctProdMast;

/**
 * 核心处理中心 账户产品主表 查询DAO
 * 
 * @CpsAcctProdMastQueryDAOImpl.java
 * @author MA HUAN
 * @2013-3-28 下午5:05:12 www.gopay.com.cn Inc.All rights reserved.
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
@Repository(value = "cpsAcctProdMastQueryDAO")
public class CpsAcctProdMastQueryDAOImpl extends BaseDAOImpl<CpsAcctProdMast, Serializable> implements
        CpsAcctProdMastQueryDAO {

    @Override
    public List<CpsAcctProdMast> findByProdLineId(String prodLineId) {
        
        if(StringUtils.isEmpty(prodLineId)) {
            return null;
        }
        
        String hql = " from CpsAcctProdMast capm where capm.prodLineId = :ProdLineId";

        Map params = new HashMap();
        params.put("ProdLineId", prodLineId);

        return super.findByHql(hql, params);
    }

    @Override
    public List<CpsAcctProdMast> findAvaliableAcctProd() {
        // TODO Auto-generated method stub
        return findByProdLineId(CpsConstants.DEFAULT_PRODLINE_ID);
    }

}
